home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / vtcl / doc / DetachPids.3 < prev    next >
Encoding:
Text File  |  1995-07-10  |  3.6 KB  |  87 lines

  1. '\"
  2. '\" Copyright (c) 1989-1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/DetachPids.3,v 1.10 93/09/09 10:53:24 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. '\"----------------------------------------------------------------------------
  24. '\"    @(#) DetachPids.3 26.1 93/10/22 SCOINC
  25. '\"
  26. '\"     Copyright (C) The Santa Cruz Operation, 1992-1993.
  27. '\"     This Module contains Proprietary Information of
  28. '\"    The Santa Cruz Operation, and should be treated as Confidential.
  29. '\"----------------------------------------------------------------------------
  30. .so ../man.macros
  31. .HS Tcl_DetachPids tclc
  32. .BS
  33. .SH NAME
  34. Tcl_DetachPids, Tcl_ReapDetachedProcs \- manage child processes in background
  35. .SH SYNOPSIS
  36. .nf
  37. \fB#include <tcl.h>\fR
  38. .sp
  39. \fBTcl_DetachPids\fR(\fInumPids, pidPtr\fR)
  40. .sp
  41. .VS
  42. \fBTcl_ReapDetachedProcs\fR()
  43. .VE
  44. .SH ARGUMENTS
  45. .AS int *statusPtr
  46. .AP int numPids in
  47. Number of process ids contained in the array pointed to by \fIpidPtr\fR.
  48. .AP int *pidPtr in
  49. Address of array containing \fInumPids\fR process ids.
  50. .BE
  51.  
  52. .SH DESCRIPTION
  53. .PP
  54. .VS
  55. \fBTcl_DetachPids\fR and \fBTcl_ReapDetachedProcs\fR provide a
  56. mechanism for managing subprocesses that are running in background.
  57. These procedures are needed because the parent of a process must
  58. eventually invoke the \fBwaitpid\fR kernel call (or one of a few other
  59. similar kernel calls) to wait for the child to exit.  Until the
  60. parent waits for the child, the child's state cannot be completely
  61. reclaimed by the system.  If a parent continually creates children
  62. and doesn't wait on them, the system's process table will eventually
  63. overflow, even if all the children have exited.
  64. .PP
  65. \fBTcl_DetachPids\fR may be called to ask Tcl to take responsibility
  66. for one or more processes whose process ids are contained in the
  67. \fIpidPtr\fR array passed as argument.  The caller presumably
  68. has started these processes running in background and doesn't
  69. want to have to deal with them again.
  70. .PP
  71. \fBTcl_ReapDetachedProcs\fR invokes the \fBwaitpid\fR kernel call
  72. on each of the background processes so that its state can be cleaned
  73. up if it has exited.  If the process hasn't exited yet,
  74. \fBTcl_ReapDetachedProcs\fR doesn't wait for it to exit;  it will check again
  75. the next time it is invoked.
  76. Tcl automatically calls \fBTcl_ReapDetachedProcs\fR each time the
  77. \fBexec\fR command is executed, so in most cases it isn't necessary
  78. for any code outside of Tcl to invoke \fBTcl_ReapDetachedProcs\fR.
  79. However, if you call \fBTcl_DetachPids\fR in situations where the
  80. \fBexec\fR command may never get executed, you may wish to call
  81. \fBTcl_ReapDetachedProcs\fR from time to time so that background
  82. processes can be cleaned up.
  83. .VE
  84.  
  85. .SH KEYWORDS
  86. background, child, detach, process, wait
  87.